package com.bolt.admin.web.controller;

import com.bolt.admin.common.base.SimpleController;
import com.bolt.admin.module.sys.service.MonitorService;
import com.bolt.convention.data.ResultMessage;
import com.bolt.convention.data.Returns;
import com.bolt.convention.data.Record;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Administrator on 2020/10/20.
 */

@Controller
@RequestMapping("/admin/sys/monitor")
@Api(tags = "系统-服务监控管理")
public class MonitorController extends SimpleController {

    @Autowired
    private MonitorService monitorService;

    /**
     * 模块首页
     */
    @RequestMapping(value = "", method = RequestMethod.GET)
    public ModelAndView index(Model model, HttpServletRequest request) {
        return super.index("/admin/sys/monitor/index", request, model.asMap());
    }

    @RequestMapping(value = "info", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("查询服务监控")
    public ResultMessage info() {
         Record data = monitorService.getServers();
        return  Returns.success(data);
    }


}

 